/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * FrameEnsayo.java
 *
 * Created on Sep 19, 2012, 7:55:05 PM
 */
package ar.com.wholeconsulting.pacc.gui.aparatos.ensayos;

import ar.com.wholeconsulting.pacc.model.Aparato;
import ar.com.wholeconsulting.pacc.model.ensayos.Ensayo;

/**
 *
 * @author pable
 */
public class FrameEnsayo extends javax.swing.JFrame {

    private Aparato currentAparato;
    private Ensayo currentEnsayo;

    /** Creates new form FrameEnsayo */
    public FrameEnsayo() {
        initComponents();
        initComponentsView();
    }

    public FrameEnsayo(Aparato aparato, Ensayo en) {
        initComponents();
        initComponentsView();
    }


    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jXDatePicker1 = new org.jdesktop.swingx.JXDatePicker();
        jLabel1 = new javax.swing.JLabel();
        comboEnsayo = new javax.swing.JComboBox();
        jLabel2 = new javax.swing.JLabel();
        tabbedEnsayos = new javax.swing.JTabbedPane();
        panelMedicionDeEspesores = new javax.swing.JPanel();
        panelHidraulica = new javax.swing.JPanel();
        panelNeumatica = new javax.swing.JPanel();
        panelCalibracion = new javax.swing.JPanel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jLabel1.setText("Fecha de Realizacion:");

        comboEnsayo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Medicion de Espesores", "Prueba Hidraulica", "Prueba Neumatica", "Calibracion de Valvulas de Seguridad" }));
        comboEnsayo.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                comboEnsayoItemStateChanged(evt);
            }
        });

        jLabel2.setText("Tipo de Ensayo");

        javax.swing.GroupLayout panelMedicionDeEspesoresLayout = new javax.swing.GroupLayout(panelMedicionDeEspesores);
        panelMedicionDeEspesores.setLayout(panelMedicionDeEspesoresLayout);
        panelMedicionDeEspesoresLayout.setHorizontalGroup(
            panelMedicionDeEspesoresLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 399, Short.MAX_VALUE)
        );
        panelMedicionDeEspesoresLayout.setVerticalGroup(
            panelMedicionDeEspesoresLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 267, Short.MAX_VALUE)
        );

        tabbedEnsayos.addTab("Mediocion de Espesores", panelMedicionDeEspesores);

        javax.swing.GroupLayout panelHidraulicaLayout = new javax.swing.GroupLayout(panelHidraulica);
        panelHidraulica.setLayout(panelHidraulicaLayout);
        panelHidraulicaLayout.setHorizontalGroup(
            panelHidraulicaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 399, Short.MAX_VALUE)
        );
        panelHidraulicaLayout.setVerticalGroup(
            panelHidraulicaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 267, Short.MAX_VALUE)
        );

        tabbedEnsayos.addTab("Prueba Hidraulica", panelHidraulica);

        javax.swing.GroupLayout panelNeumaticaLayout = new javax.swing.GroupLayout(panelNeumatica);
        panelNeumatica.setLayout(panelNeumaticaLayout);
        panelNeumaticaLayout.setHorizontalGroup(
            panelNeumaticaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 399, Short.MAX_VALUE)
        );
        panelNeumaticaLayout.setVerticalGroup(
            panelNeumaticaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 267, Short.MAX_VALUE)
        );

        tabbedEnsayos.addTab("Prueba Neumatica", panelNeumatica);

        javax.swing.GroupLayout panelCalibracionLayout = new javax.swing.GroupLayout(panelCalibracion);
        panelCalibracion.setLayout(panelCalibracionLayout);
        panelCalibracionLayout.setHorizontalGroup(
            panelCalibracionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 399, Short.MAX_VALUE)
        );
        panelCalibracionLayout.setVerticalGroup(
            panelCalibracionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 267, Short.MAX_VALUE)
        );

        tabbedEnsayos.addTab("Calibracion de Valvulas de Seguridad", panelCalibracion);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(tabbedEnsayos, javax.swing.GroupLayout.DEFAULT_SIZE, 407, Short.MAX_VALUE)
                    .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 407, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(comboEnsayo, 0, 394, Short.MAX_VALUE)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addComponent(jXDatePicker1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 198, Short.MAX_VALUE)))
                        .addContainerGap(13, Short.MAX_VALUE))))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jXDatePicker1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(comboEnsayo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(tabbedEnsayos, javax.swing.GroupLayout.DEFAULT_SIZE, 361, Short.MAX_VALUE)
                .addContainerGap())
        );

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-421)/2, (screenSize.height-531)/2, 421, 531);
    }// </editor-fold>//GEN-END:initComponents

    private void comboEnsayoItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_comboEnsayoItemStateChanged
        tabbedEnsayos.removeAll();
        switch (comboEnsayo.getSelectedIndex()) {
            case 0:
                tabbedEnsayos.add(panelMedicionDeEspesores);
                break;
            case 1:
                tabbedEnsayos.add(panelHidraulica);
                break;
            case 2:
                tabbedEnsayos.add(panelHidraulica);
                break;
            case 3:
                tabbedEnsayos.add(panelNeumatica);
                break;

        }

    }//GEN-LAST:event_comboEnsayoItemStateChanged

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new FrameEnsayo().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JComboBox comboEnsayo;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private org.jdesktop.swingx.JXDatePicker jXDatePicker1;
    private javax.swing.JPanel panelCalibracion;
    private javax.swing.JPanel panelHidraulica;
    private javax.swing.JPanel panelMedicionDeEspesores;
    private javax.swing.JPanel panelNeumatica;
    private javax.swing.JTabbedPane tabbedEnsayos;
    // End of variables declaration//GEN-END:variables

    private void initComponentsView() {
        tabbedEnsayos.removeAll();
        tabbedEnsayos.add(panelMedicionDeEspesores);
    }
}
